Skip to content

[rust] Allow cross-compilation of selenium-manager on all platforms#17586

Open
AutomatedTester wants to merge 1 commit into
trunkfrom
worktree-pr-17427-cross-compile
Open

[rust] Allow cross-compilation of selenium-manager on all platforms#17586
AutomatedTester wants to merge 1 commit into
trunkfrom
worktree-pr-17427-cross-compile

Conversation

@AutomatedTester

Copy link
Copy Markdown
Member

Summary

Taking over #17427 from @shs96c who was unable to complete it.

This PR enables cross-compilation of selenium-manager from any host platform to all target platforms (Linux x86_64/aarch64, macOS aarch64, Windows x86_64/aarch64) using the hermetic LLVM toolchain.

Key changes (from Simon's original work)

  • Upgrades rules_rs 0.0.61 → 0.0.76 and llvm 0.7.9 → 0.8.0
  • Registers LLVM exec toolchains for Linux (x86_64, aarch64) and macOS (aarch64)
  • Adds cross-compile targets for all five platforms in rust/BUILD.bazel
  • Restructures language binding (py, rb, dotnet, java) BUILD files to consume a per-arch bundle
  • On Windows, uses native MSVC build for the host arch and stubs the rest (cross-compile from Linux for releases)
  • Adds musl targets for Linux (no glibc dependency) and gnullvm targets for Windows

Fixes applied in this PR (on top of Simon's work)

  • windows-link/windows-targets patches: The original patches changed include_str!("../readme.md")include_str!("../README.md") but the crate only ships readme.md and Bazel's Rust sandbox doesn't include non-source files anyway. Fixed by removing the doc attribute entirely.
  • Windows MSVC linker: The hermetic LLVM package for Windows provides only a GNU-mode clang++.exe which can't handle MSVC-style linker flags (/NOLOGO, .lib files). Re-enabled MSVC CC auto-detection on Windows so Visual Studio's link.exe is used for MSVC targets.

Known remaining issues

  • macOS Rust tests: aws-lc-sys (pulled in transitively through reqwestrustlsrustls-platform-verifier) requires CoreServices.framework which is not in the hermetic LLVM macOS SDK sysroot. Adding the aarch64 macOS exec LLVM toolchain (new in this PR) causes this to surface. Fixing requires either a different TLS cert backend or a richer macOS sysroot — tracked as a follow-up.

Closes #17427

@selenium-ci selenium-ci added C-py Python Bindings C-rb Ruby Bindings C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations C-rust Rust code is mostly Selenium Manager B-manager Selenium Manager labels May 28, 2026
@AutomatedTester AutomatedTester force-pushed the worktree-pr-17427-cross-compile branch from ebcdc24 to f1cc57a Compare June 1, 2026 13:16
@titusfortner

Copy link
Copy Markdown
Member

It's suboptimal, but I'm ok with Windows or Mac not being able to cross compile everything so long as Linux can do it all.

The primary missing piece as I see it is the lack of x86 support for Mac. Ideally we can continue to release a fat binary instead of requiring the bindings to pick between them, but I guess the bindings fix is easy enough if we need to go that route.

Cross-compiles selenium-manager for every supported OS/arch via rules_rs
platform transitions + the hermetic @llvm toolchain (musl on Linux,
gnullvm on Windows), so release bundles can build all platform binaries
from a single host. Bindings (Java, Python, Ruby, JS, .NET) updated to
probe per-(os, arch) paths from the bundle.

Rebased onto trunk's rules_rs 0.0.90 / @llvm-on-macOS work (#17683).
@AutomatedTester AutomatedTester force-pushed the worktree-pr-17427-cross-compile branch from 68c9337 to 3d919b2 Compare June 16, 2026 11:28
@AutomatedTester

Copy link
Copy Markdown
Member Author

https://bazelbuild.slack.com/archives/CSV56UT0F/p1781613082861409

Raised the above discussion as I think there is a bug in the way transitive deps are handled

@AutomatedTester

Copy link
Copy Markdown
Member Author

https://bazelbuild.slack.com/archives/CSV56UT0F/p1781613082861409

Raised the above discussion as I think there is a bug in the way transitive deps are handled

I need to come back to this next week and watch updates to rules_rs

@MugundanMCW

Copy link
Copy Markdown

Hi @AutomatedTester
Any updates on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-manager Selenium Manager C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings C-rust Rust code is mostly Selenium Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants